import React from 'react';
import { Link } from 'react-router';

export default class Approvals extends React.Component{

    render(){
        var articles = [];
        let count = 0;
        console.log(this.props.articles);
        this.props.articles.map(function(article){
            var linkTo = "/review/" + article.ID+"/"+sessionStorage.token;
            articles.push(
                <Link to={linkTo} key={count++}>
                <div className="article-item">
                    <div className="article-image-outer">
                        <img src={article.FeaturedImage} className="article-image"/>
                    </div>
                    <div className="article-body">
                        <h4 className="article-title">
                            {article.Title}
                        </h4>
                        <h5 className="article-title">{article.PublishedDateString}{article.ApproveFlag&&<i className="fa fa-check" style={{color:"green"}} aria-hidden="true"></i>}</h5>
                    </div>
                    <div style={{clear:"both"}}></div>
                </div>
                </Link>
            );
        });

        return(
            <div className="articles">
                {articles}
            </div>
        );
    }
}
